package com.xl.utils.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author xionglin
 * @Classname PagingParam
 * @Description 分页参数
 * @Date 2019/6/25 11:23
 */
@Deprecated
public class PagingParam implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        /*本来是想用TreadLocal类做一个全局获取分页数据的封装，然后直接在分页的时候用的，想想算了，封装一个分页的参数接受对象在controller用算了*/
        //获取参数
        //当前页 private int  pageNum（页码）;
        String pageNum = request.getParameter("pageNum");
        //每页的数量 private int  pageSize;
        String pageSize = request.getParameter("pageSize");
        //排序字段 private String  sortField;
        String sortField = request.getParameter("sortField");
        //排序方式 private String sortBy;
        String sortBy = request.getParameter("sortBy");
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

    }
}
